package com.example.cloudcashierpos.app;

import android.app.Activity;
import android.util.DisplayMetrics;

/**
 * 初始化app
 */
public class AppConfig {

    /**
     * 屏幕的宽度
     */
    private static int SCREEN_WIDTH = 0;

    /**
     * 屏幕的高度
     */
    private static int SCREEN_HEIGHT = 0;

    /**
     * 屏幕的密度
     */
    private static float SCREEN_DENSITY = 0.0f;


    public static void init(Activity activity) {
        if (SCREEN_DENSITY == 0 || SCREEN_WIDTH == 0 || SCREEN_HEIGHT == 0){
            //屏幕参数初始化
            DisplayMetrics dm = new DisplayMetrics();
            activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
            AppConfig.SCREEN_DENSITY = dm.density;
            AppConfig.SCREEN_HEIGHT = dm.heightPixels;
            AppConfig.SCREEN_WIDTH = dm.widthPixels;

        }
    }
}